<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
$(function(){
	common.ajaxQuery("${root}/stock/mine/list");
});

function updateStock(index){
	$("#stock"+index).removeAttr("disabled");
	$("#btnSave"+index).removeClass("hide");
	$("#btnCancel"+index).removeClass("hide");
	$("#btnUpdate"+index).addClass("hide");
	return false;
}

function saveStock(id,index){

	var val = $("#stock"+index).val();

	if(common.isEmpty(val) || common.isNotNumberic(val)){
		
		common.modalGlobalMessage("请输入数字(>=0)类型的库存!");
		return false;
	}
	var uri = "${root}/stock/mine/update/"+id + "/"+val;
		common.ajaxSubmit(uri,"","修改库存失败","",'common.ajaxQuery("${root}/stock/mine/list")');
	return false;
}

function cancelStock(index){
	$("#stock"+index).attr("disabled","disabled");
	$("#btnSave"+index).addClass("hide");
	$("#btnCancel"+index).addClass("hide");
	$("#btnUpdate"+index).removeClass("hide");
	return false;
}

</script>
<form class="form-horizontal" id="queryForm" role="form">
	<input name="orderName" value="" type="hidden">
	<table class="table table-hover">
		<tr>
			<th>配件库存类型:</th>
			<td>
				<select id="firstCat" name="stockType" class="input-xlarge" >
					<c:forEach var="item" items="${stockProductTypes}">
						<option value="${item}"><spring:message code="${item}"/></option>
					</c:forEach>
				</select>
			</td>
			<th>网点名称:</th>
			<td>
				<select  name="shopId" class="input-xlarge" >
					<option value=""></option>
					<c:forEach var="item" items="${shops}">
						<option value="${item.id }"><c:out value="${item.name }"/></option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<th>配件编码:</th>
			<td><input type="text" class="input-xlarge" name="productPartId"/></td>
			<th>配件名称:</th>
			<td>
				<input type="text" class="input-xlarge" name="productPartName"/>
			</td>
		</tr>
	</table>
	<div class="form-actions text-center">
		<button type="button" class="btn btn-primary" onclick="common.ajaxQuery('${root}/stock/mine/list')">查询</button>
	 </div>
</form>
<div class="table-responsive">
<table class="table table-striped table-bordered">
	<thead>
		<tr >
			<th class="text-center">网点</th>
			<th class="span3 text-center">配件编码</th>
			<th class="span3 text-center">配件名称</th>
			<th class="span3 text-center">库存类型</th>
			<th class="span2 text-center">金额</th>
			<th class="span2 text-center">库存</th>
			<th class="span2 text-center">操作</th>
		</tr>
	</thead>
	<tbody id="dataList">
	</tbody>
</table>
</div>

